﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;

using Bpms.Data;
using Bpms.Entity;
using Bpms.Log;
namespace Bpms.Data.SqlServer
{
    public partial class DataProvider
    {

        public bool InsertArea(AreaInfo area)
        {
            using (SqlConnection conn = new SqlConnection(DbHelper.ConnectionString))
            {
                conn.Open();
                using (SqlTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        //SqlParameter
                        DbHelper.ExecuteNonQuery(trans, CommandType.Text, "SELECT * FROM [user]");
                        trans.Commit();

                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        throw ex;
                    }
                }
            }

            using (DbConnection conn = new SqlConnection(DbHelper.ConnectionString))
            {
                conn.Open();
                using (DbTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        //SqlParameter
                        DbHelper.ExecuteNonQuery(trans, CommandType.Text, "SELECT * FROM [user]");
                        trans.Commit();

                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        throw ex;
                    }
                }
            }

            using (DbConnection conn = DbHelper.Factory.CreateConnection())
            {
                conn.ConnectionString = DbHelper.ConnectionString;
                conn.Open();
                using (DbTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        //SqlParameter
                        DbHelper.ExecuteNonQuery(trans, CommandType.Text, "SELECT * FROM [user]");
                        trans.Commit();

                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        throw ex;
                    }
                }
            }

            return true;
        }


        public bool UpdateArea(AreaInfo area)
        {

            return true;

        }

        public bool DeleteArea(int areaId)
        {
            return true;
        }

        public bool AreaExists(AreaInfo area, OperateType type)
        {
            return true;
        }

        public AreaInfo GetArea(int areaId)
        {
            return null;
        }

        public IList<AreaInfo> GetAreas(int pageId, int pageSize, string condition)
        {
            return null;
        }

    }
}
